<#include "/common/head.html"/>

 <div class="easyui-panel updatePage" data-options="fit:true,border:false">
    <form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
        <table class="table1">
            <tr>
           		<th><span>原始密码：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-validatebox" type="password" name="old_password" id="old_password" data-options="fit: true, required:true"></input></div>
           		</td>
            </tr>
            <tr>
           		<th><span>新密码：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-validatebox" type="password" name="password" id="password" data-options="fit: true, required:true"></input></div>
           		</td>
            </tr>
            <tr>
           		<th><span>确认新密码：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-validatebox" type="password" name="re_password" id="re_password" data-options="fit: true, required:true" validType="equals['#password']"></input></div>
           		</td>
           		
            </tr>
        </table>
    </form>
</div>
<script>
top.window.subPage.save = save;
function save() {
	if($("#ff").form('enableValidation').form('validate')) {
		$.post("updatePassword", getParam(), function(data) {
			if(data.result === "success") {
				top.window.closeWindow();
				top.window.subPage.loadCurrDatagrid();
			}
		});
	}
}
function getParam() {
	var param = {
	    "id": ${model.id}, 
     	"model.user_name": getInputValue("user_name"), 
     	"model.password": getInputValue("password"), 
     	"model.old_password": getInputValue("old_password"), 
	}
	for(key in param) {
		if(!param[key]) {
			delete param[key];
		}
	}
	return param;
}

//扩展js
$(function() {
 changeComboboxToMult("roles");
});
</script>
<#include "/common/foot.html"/>
